一个程序是一个双重实体,常被描述为 “机器中的幽灵。” 它同时以人类编写的静态文本和动态、无形的机器形式存在,后者负责操控物理硬件。计算机仅仅作为 主机 这些基于逻辑的构造体的主机。
1. 三重存在
一个程序以三种方式显现:作为可读的源代码、内存中的二进制数据,以及控制该内存的主动力量。程序员是 宇宙的创造者 几乎无限复杂性的创造者,其全部由他们所定义的逻辑所支配。
物质宿主
物理硬件、大型机和电路。
物理硬件、大型机和电路。
无形的访客
逻辑、‘幽灵’以及程序的意图。
逻辑、‘幽灵’以及程序的意图。
2. 控制复杂性
编程是一种 驾驭复杂性的技能。一个优秀的程序能让复杂的系统看起来简单。虽然计算机语言不如人类语言灵活,但它们遵循严格的语法规则以确保精确性。
超越浏览器: 要在此课程之外的网页浏览器中运行程序,你可以使用 Node.js。
我们将构建的宇宙: 人工生命模拟 • 平台游戏 • 绘图程序 • 动态网站
main.py
TERMINALbash — 80x24
> Ready. Click "Run" to execute.
>
QUESTION 1
In the context of the 'Ghost in the Machine', what is the role of the physical computer?
It is the primary source of intelligence.
It acts as a host for the immaterial machine (the program).
It is the 'Ghost' itself.
It is a human-readable text repository.
✅ Correct!
The computer is the physical host that provides the environment for the program to act as an immaterial machine.❌ Incorrect
The computer is the hardware 'host'; the program is the directing 'ghost'.QUESTION 2
According to the text, what is the 'art of programming'?
Writing as many lines of code as possible.
The skill of controlling and subduing complexity.
Making a program as grammatically flexible as English.
Designing hardware components.
✅ Correct!
The great program is simple in its complexity; the goal is to manage and subdue intricate logic.❌ Incorrect
Complexity should be subdued and made simple, not merely increased.QUESTION 3
Which of these is NOT one of the 'three things' a program is simultaneously?
A piece of text typed by a programmer.
Data residing in the computer's memory.
A physical transistor inside the CPU.
The force directing the computer's actions.
✅ Correct!
Programs are immaterial machines; they are text, data, and logic, not the physical transistors themselves.❌ Incorrect
The 'Triple Existence' includes text, memory data, and the directing force.QUESTION 4
How do computer languages compare to human languages in terms of grammar?
They are more grammatically flexible.
They follow no grammatical rules.
They are typically less grammatically flexible.
They are identical in every way.
✅ Correct!
Computer languages require absolute precision and are less flexible than natural human languages.❌ Incorrect
Computer languages are rigid and require strict adherence to syntax.QUESTION 5
What platform is recommended to run JavaScript programs outside of the web browser?
Java Runtime Environment
Node.js
Python Desktop
HTML5 Engine
✅ Correct!
Node.js allows you to execute JavaScript directly on your machine without a browser.❌ Incorrect
Node.js is the standard environment for running JS logic server-side or on the desktop.Case Study: The Architect of Universes
Complexity Management in Digital Systems
You are tasked with building an artificial life simulation. The logic involves thousands of entities interacting, yet you must ensure the program remains readable and maintainable for other developers.
Q
Explain how the program acts as a 'directing force' in this simulation.
Solution:
The program is the 'ghost' that dictates how data in the computer's memory (representing biological entities) moves and changes, transforming static values into dynamic behaviors.
The program is the 'ghost' that dictates how data in the computer's memory (representing biological entities) moves and changes, transforming static values into dynamic behaviors.
Q
If the simulation becomes too complex for one person to understand, which core principle of programming has been violated?
Solution:
The principle of 'subduing complexity.' The art of programming is making the complex simple; if it becomes unmanageable, the complexity has not been properly controlled.
The principle of 'subduing complexity.' The art of programming is making the complex simple; if it becomes unmanageable, the complexity has not been properly controlled.
Q
How does the 'Triple Existence' concept apply to your simulation code?
Solution:
It exists as the text you type (source), the data the computer stores about the entities (memory), and the execution logic that processes every interaction (force).
It exists as the text you type (source), the data the computer stores about the entities (memory), and the execution logic that processes every interaction (force).